package edu.hawaii.solardecathlon.page.home;

import java.util.Date;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Button;
import edu.hawaii.solardecathlon.page.BasePage;
import edu.hawaii.solardecathlon.page.ExternalImageUrl;

/**
 * The application home page.
 * 
 * @author Solar Decathlon Group 7
 */
public class HomePage extends BasePage {

  /** Support serialization. */
  private static final long serialVersionUID = 1L;

  /**
   * The home page for this application.
   */
  public HomePage() {

    // current date
    Date current = new Date();
    add(new Label("time", current.toString()));

    add(new Button("refresh") {
      private static final long serialVersionUID = 1L;

      /** Upon clicking, refresh page */
      public void onSubmit() {
        setResponsePage(HomePage.class);
      }
    });
    
    // left side content
    add(new Button("on"));
    add(new Button("off"));
    String link =
        "http://chart.apis.google.com/chart?chxl=1:|Heater|Cooling|Lighting|Outlets"
            + "&chxp=1,0.5,1.5,2.5,3.5&chxr=0,0,10|1,0,4&chxt=x,y&chbh=a&chs=300x150&cht=bhs"
            + "&chco=008000&chds=0,10&chd=t:2.7,3.8,6.2,4.5&chdl=kwh";
    add(new ExternalImageUrl("BarChart", link));
  }
}
